home *** CD-ROM | disk | FTP | other *** search
/ Mars Pathfinder Website / Mars Pathfinder Website.iso / mpf / rovercom / iaa_paper.txt < prev    next >
Encoding:
Text File  |  1998-11-13  |  22.9 KB  |  451 lines

  1. Second International Academy of Astronautics 
  2. Conference on Low Cost Planetary Missions
  3. April 16 -19, 1996
  4. Paper IAA-L-0504P
  5.  
  6. ON-BOARD SOFTWARE FOR THE MARS PATHFINDER MICROROVER
  7.  
  8. Jack Morrison and Tam Nguyen 
  9. Jet Propulsion Laboratory 
  10. California Institute of Technology
  11. 4800 Oak Grove Drive
  12. Pasadena, California 91109
  13.  
  14.  
  15. ABSTRACT
  16.  
  17. The Pathfinder Micro-rover Flight experiment will perform
  18. engineering and science experiments on the Martian surface
  19. to pave the way for future Mars missions. The rover is controlled
  20. by a 1970's era microprocessor. Its on-board software, while in 
  21. some ways a typical embedded-system design, has to deal with 
  22. some unusual constraints.
  23.  
  24. The rover will be operating in a harsh and mostly unknown
  25. environment, with limited electrical and processing power, 
  26. accessible only via a limited-bandwidth communication link
  27. with long time delays. The software design is driven by these 
  28. factors to provide reliability in the face of hardware, software,
  29. and operational failures, flexibility to allow adaptation and
  30. reconfiguration, simplicity, predictability, and visibility into
  31. its internal state and the external environment.
  32.  
  33. This paper describes the overall software structure, and details
  34. some of the more interesting features of the design, including
  35. error handling, power control logic, and navigation with hazard 
  36. avoidance. The development environment is also described, including
  37. the use of world-wide-web-style hypertext to provide quick access
  38. to the collection of documents that accumulate in a software project.
  39.  
  40.  
  41. MISSION TO MARS
  42.  
  43. The Mars Pathfinder Microrover, a 10-kilogram
  44. robotic vehicle, will perform engineering and science experiments 
  45. on the Martian surface, and pave the way for future Mars exploration. 
  46. Due to the communication time delays between Earth and Mars, and
  47. the unpredictability of the surface environment, the rover must
  48. operate semi-autonomously based on traverse waypoints and high-level
  49. commands from a human operator.
  50.  
  51. Research robots like the Pathfinder rover's predecessors
  52. often sport state-of-the-art processors, but a flight project
  53. requires proven, radiation-hardened components and imposes a
  54. severe power and weight budget. With the limited financial 
  55. budget of a low-cost flight project on top of that, the result
  56. is a spacecraft with a difficult mission, a short development
  57. schedule, and a "computationally-challenged" central processing
  58. unit. 
  59.  
  60. The rover's software architecture is motivated by several ideals
  61. intended to meet the mission goals while addressing all of these
  62. limitations:
  63.  
  64. - Reliability: handling failures of non-essential hardware
  65.   components and unexpected environmental conditions. Time-critical
  66.   anomalies (such as power drains and obstacle contact) must
  67.   be handled without operator intervention. Software failures must
  68.   be protected against occurring, and recovered from if they do occur.
  69.   
  70. - Flexibility: adapting to changes in the rover's hardware and
  71.   environment. Modifications to behavior should be autonomous or
  72.   easily commandable. Where possible, the rover is self-calibrating.
  73.   
  74. - Simplicity: in general, the simplest acceptable approach to each
  75.   requirement or design problem is chosen. Besides being more reliable
  76.   and flexible, simpler solutions are easier to test and have more
  77.   predictable behavior. Not to mention taking less time to develop.
  78.  
  79. - Visibility: concisely but completely reporting the current hardware
  80.   and software state, in particular unexpected conditions.
  81.   
  82.  
  83. GENERAL SOFTWARE ARCHITECTURE
  84.  
  85. The rover is so constrained by electrical and processing power
  86. that it literally cannot "walk and talk" (run drive motors and
  87. communicate over its radio modem) at the same time. A multitasking
  88. executive would reduce performance without adding much capability.
  89. So instead, the software is organized as a single control loop, with
  90. interrupt handling for a few asynchronous "reflex" events (such as
  91. bumper contact) to which the rover must react quickly. This loop
  92. dispatches periodic functions (e.g. thermal management, automatic
  93. vehicle health checks, and command upload requests) as indicated by
  94. software timers, and invokes command handlers as directed by the
  95. uploaded command sequence.
  96.  
  97. Command handlers follow a common format:
  98.  
  99.     - extract and validate any command parameters
  100.     - verify that the command is allowed based on the current
  101.       rover state (e.g. mission phase and power availability)
  102.     - set a timeout limit for completion of the command
  103.     - perform the command
  104.     - format and send results telemetry
  105.     - return a completion status 
  106.  
  107.  
  108. NAVIGATION AND HAZARD AVOIDANCE
  109.  
  110. Perhaps the most unique component of the on-board software, for a
  111. spacecraft, is the waypoint navigation and autonomous hazard
  112. avoidance logic. Since the rover is normally directed along an
  113. operator-specified path based on 3D stereo images from the 
  114. Pathfinder lander, it doesn't need to be a robust maze-solver -
  115. but it does need to watch for and deal with unexpected problems
  116. while moving.
  117.  
  118. The basic procedure for traversing to a waypoint is to drive forward
  119. in short segments, stopping for proximity scanning between each segment.
  120. In the absence of hazards, the rover arcs (at one of a small number
  121. of fixed-radius turns) toward the goal position. Inertial sensors
  122. and wheel encoders are used to dead reckon the vehicle's location.
  123.  
  124. While moving, other sensors (such as inclination and motor
  125. currents) are sampled for
  126. hazard detection and telemetry. Several conditions are monitored:
  127.  
  128.     - reaching an operator-specified timeout limit
  129.     - sensor reading outside safe limits, from a table based on
  130.         a risk-level parameter
  131.     - being too close to, and heading toward, the lander
  132.     - physical contact sensing
  133.     
  134. While stopped in between segments, various low-rate operations are
  135. performed when due, including a lander communication check "heartbeat"
  136. and transmission of buffered telemetry data.
  137. The rover then uses its optical proximity scanning system to look for
  138. obstacles (such as tall rocks or dropoffs). The scanner consists of
  139. infrared lasers and CCD imagers, which are used to build a sparse
  140. and approximate map of terrain height in front of the rover.
  141.  
  142. The map is searched for the following hazard conditions:
  143.  
  144.     - missing data (inside the minimum required detection range;
  145.         indicating a possible drop-off)
  146.     - height difference between any two adjacent detections
  147.         above a (risk-level-dependent) threshold
  148.         (indicating a rock or hole)
  149.     - height difference between lowest and highest detections
  150.         above a higher threshold (indicating a steep slope)
  151.  
  152. If any proximity hazards are found in the map, the rover
  153. turns in place about its center as needed to avoid them.
  154. It first turns in whichever direction has the smaller required
  155. avoidance turn, or toward the goal if there's no preference. 
  156. On any subsequent turns (after re-scanning) at the same location,
  157. it continues to turn in the same direction, to avoid bouncing back and
  158. forth between two hazards.
  159. Non-proximity hazards, such as contact and sensor readings outside 
  160. safety limits, result in aborting the traverse - unless the
  161. operator has given the rover permission to deal with these itself.
  162. In that case, it backs up, turns, and tries again. Any time it
  163. has turned away from a hazard, the rover drives straight for a
  164. few segments before arcing back toward the goal.
  165.  
  166. Normally, the rover tries to keep far enough away from any hazards to
  167. allow it to turn around if it should get into trouble. The software
  168. has an option, however, to "squeeze" through narrower paths for a
  169. limited distance. If it runs into obstacles or fails to reach a clear
  170. region beyond this distance, it backs straight out and turns away from
  171. the narrow path looking for another alternative.
  172.  
  173. "Rock finding" is a modified driving mode, in which map
  174. data indicating a prominent rock triggers a behavior to center the
  175. rover heading between the edges of the rock using proximity
  176. sensing. If the destination waypoint is reached first,
  177. the rover performs a spiral search for a rock. The operator can then
  178. command the rover to turn 180 degrees and back its spectrometer
  179. onto the rock surface.
  180.  
  181.  
  182. STATE INFORMATION
  183.  
  184. Nearly all of the global data is allocated in one of two structures -
  185. the volatile state area and the persistent state area. The volatile
  186. state data is initialized at each wakeup, and includes latest sensor
  187. readings and navigation control states.
  188.  
  189. The persistent state data is the rover's "long-term memory." It is
  190. loaded from EEPROM (electrically-eraseable programmable read-only
  191. memory) at wakeup, and the EEPROM image is updated regularly
  192. as the state changes. This data includes mission phase, vehicle
  193. location, odometry, and long-term time limits.
  194.  
  195. Persistent state data is the only part of the EEPROM that needs to 
  196. be rewritten enough times to be in danger of exceeding the guaranteed 
  197. lifetime of the memory during development and the mission. Enough space 
  198. is therefore reserved for several copies of the state data, and the
  199. active copy is accessed indirectly through a pointer stored separately
  200. in EEPROM (this pointer is itself updated infrequently, so it can
  201. stay in a fixed location). A count of the number of rewrites is updated
  202. and stored with the persistent state; if this count reaches 95% of
  203. the guaranteed EEPROM lifetime (which is 1/10th the nominal lifetime),
  204. the state data is automatically relocated to the next allocated space.
  205. The pointer is updated accordingly, and the write count reset to one.
  206.  
  207. POWER CONTROL AND DEVICE MONITORING
  208.  
  209. Each controllable device, and each input sensor, is associated with a device
  210. status value indicating the health of that device. The value is automatically
  211. adjusted if anomalous behavior (such as an out-of-range input) is seen
  212. from that device, typically during periodic health checks, and adjusted back
  213. if normal operation is observed. With several steps between "normal" and
  214. "failed" states, the rover can autonomously disregard suspicious sensor
  215. data but recover from transient failures. At cold start, the status
  216. for failed devices is adjusted to that they have one chance to show that
  217. they are now working properly.
  218.  
  219. If a sensor reaches a "failed" state, the rover avoids using that sensor to
  220. influence its behavior. If possible, it uses an alternate source of 
  221. information as a fallback. For example, it one temperature sensor fails,
  222. it may use a nearby temperature sensor instead. If a potentiometer indicating
  223. motor position fails, the rover can fall back to time-delay-based
  224. actuator control. However, actual sensor readings are always returned in 
  225. telemetry - regardless of whether the rover trusts that data.
  226.  
  227. If an actuator devices reaches a "failed" state, the rover rejects operator
  228. commands that depend on that device functioning. The device status values
  229. are reported with health check telemetry, and can be modified directly
  230. by operator command. Special values allow the operator to force a device
  231. into a "good" or "failed" state which the software won't autonomously
  232. alter.
  233.  
  234. Whenever a device is turned on, the rover monitors the electrical current
  235. drawn by that device (after a short delay to allow for transients). If
  236. this current exceeds a device-specific limit, the rover sets the device's
  237. status to an additional special "failed" state that prevents that device
  238. from being turned back on. It can even mark a device with this "keep off"
  239. state if powering the device causes a system reset or trips the brownout-
  240. protection power monitor circuit. This logic reduces the chances of running
  241. down batteries or damaging electronics should a device short-circuit.
  242. The "keep off" state can be cleared (or set) by operator command.
  243.  
  244. Device status was a convenient capability during testing, because
  245. at any one time, some part of the vehicle was often missing. By setting
  246. the corresponding devices as "failed", the software could operate while
  247. ignoring invalid data from missing sensors.
  248.  
  249. CONTROL PARAMETERS
  250.  
  251. Numeric "constants" in the rover software are implemented in three
  252. forms. Those that are sure to remain fixed are coded as compile-time
  253. constants ("#define" preprocessor symbols or "enum" compiler constants).
  254.  
  255. "Constants" that will probably remain fixed, but could conceivably need
  256. to be altered to deal with unexpected conditions, are coded as
  257. "const" values, resulting in runtime constants stored in non-volatile
  258. memory with the code. Since the values exist at a single location that
  259. is identified in the linker map, these can be readily patched before or 
  260. during the mission. A common use of patchable constants are the time
  261. delays needed between various control steps.
  262.  
  263. Finally, for a limited set of parameters that the operator might
  264. need to alter during the course of the mission to alter vehicle
  265. behavior, run-time variables or "control parameters" are provided.
  266. A dedicated operator command allows these parameters, which are part
  267. of the persistent state data maintained in EEPROM, to be easily
  268. changed. This "set parameter" command contains a table of valid limits
  269. for each control parameter to prevent acceptance of improper values.
  270. Some examples are navigation algorithm options, temperature thresholds
  271. for heating logic, and periodic processing rates. In addition to "behavior 
  272. modification"-type parameters, some control parameters are used to store 
  273. calibration data, such as zero offsets for position sensors, that can be 
  274. updated late in the integration test phase based on experimental 
  275. calibration measurements using the final flight hardware.
  276.  
  277. ERROR HANDLING
  278.  
  279. Two mechanisms handle error situations: an error reporting capability,
  280. and error state flags. The reporting function is invoked whenever a
  281. new anomaly is detected. An error ID unique to the source code location
  282. (8 bits indicating the module and 8 bits indicating an error call within
  283. that module), along with a severity level and a few words of optional
  284. associated information, are passed to the error reporter. If the severity
  285. level passes the current reporting threshold, this data is time-tagged and
  286. stored in a telemetry packet that is sent at the completion of the current
  287. command (or periodically, if no commands are executing). The error
  288. packet has a limited size; if it becomes full, additional error reports
  289. are counted but the associated data discarded. The severity threshold and
  290. overflow treatment prevent flooding of the telemetry channel with useless
  291. data in the event of a severe problem.
  292.  
  293. A utility program can quickly locate the program source corresponding to
  294. a specific error code, explaining the reason for and context of the error,
  295. and indicating the interpretation of the associated data. Pinpointing
  296. the error call directly in the source code eliminates the danger of
  297. an out-of-date or incomplete error code definition document, not to
  298. mention the work of maintaining one.
  299.  
  300. In addition to the error event reporting, eight error state flags
  301. track specific classes of error conditions, such as device failure,
  302. invalid command, and command execution timeout. 
  303. They are set when corresponding problems
  304. are detected, and allow a limited form of conditional command execution,
  305. since most commands are skipped if error states are active. All flags,
  306. or a selected set, can be cleared by operator command. A group of
  307. interdependent commands within an upload sequence are typically sent
  308. starting with this "clear error" command so that they can proceed
  309. regardless of an irrelevant earlier anomaly; any failures seen during
  310. execution of the group causes the rest of that group - up to the next
  311. "clear error" command - to be skipped. The operator also has the option
  312. of masking out specific error state flags, to prevent a particular
  313. type of error from affecting command execution.
  314.  
  315. ROVER LITE
  316.  
  317. The rover computer has 160K bytes of non-volatile EEPROM memory,
  318. used to store the software, persistent state data, contingency
  319. command sequences (in the event of communication loss), and
  320. telemetry that can't be immediately sent to Earth via the
  321. Pathfinder lander (e.g. at night, when the lander may not be
  322. operating its modem). This EEPROM is particularly convenient
  323. during development, since software updates are easily downloaded,
  324. but remain resident across power downs. It will also allow patches
  325. to the rover software to be sent after launch.
  326.  
  327. However, there is some concern about the radiation tolerance and
  328. reliability of these devices. The first 16K bytes of the memory
  329. space is therefore populated by (expensive) radiation-hard
  330. non-erasable PROMs. This area contains the boot code first executed
  331. when the rover wakes up. (Being primarily solar powered, the
  332. rover normally shuts itself off every night.) The boot code computes
  333. and validates checksums on the EEPROM contents. If the EEPROM looks
  334. okay, control is passed to the normal EEPROM-resident software.
  335. Otherwise, a stripped-down rover control program contained entirely
  336. in the high-reliability PROM takes over.
  337.  
  338. This scaled-back program, known as "Rover Lite", can accomplish a
  339. subset of the mission objectives without depending on non-volatile
  340. storage. It includes the full communication protocol, some diagnostic
  341. and memory patching capability, and low-level device control. About
  342. half of the normal rover commands are supported in some form, along
  343. with a special "drive" command - in place of high-level navigation -
  344. allowing a sequence of vehicle motions to be programmed, something
  345. like a remote-controlled toy.
  346.  
  347. SOFTWARE TOOLS
  348.  
  349. The only software purchased explicitly for the rover project was a
  350. PC-hosted C compiler/assembler/linker/debugger package for the
  351. 8085 target architecture, and a PC emulator allowing that software
  352. to be run from UNIX workstations. The remaining development environment
  353. is based on common facilities - such as MAKE, RCS, AWK, and text editors -
  354. that are either freely available or part of the standard UNIX environment.
  355. Where appropriate, components of the target software itself were acquired
  356. from free internet sources. These included the 8085 debug monitor, and
  357. CRC-16 and Reed/Solomon Error Detection and Correction algorithms.
  358.  
  359. ONLINE DOCUMENTATION
  360.  
  361. A new technique that has proven to be very useful is the collection
  362. of the assorted development documents that every project accumulates
  363. into web pages using a Hypertext Markup Language (HTML) index.
  364. These documents include such things as memory layouts, "how-to" 
  365. notes for startup, shutdown, calibration, and other procedures, 
  366. descriptions of utilities and development tools, coding standards,
  367. and delivery release notes. Both informal notes and official documents
  368. are accessible as web pages. Many are left as plain text files, but
  369. some have been formatted with HTML commands to allow instant access
  370. to sections of a large document or access to related documents through
  371. hypertext links. The HTML format also allows inclusion of images
  372. such as diagrams and drawings.
  373.  
  374. Having these documents available on-line in a standard format makes
  375. them readily available to the developers themselves as well as others
  376. on the project, whether they are using Unix workstations, Macs, or
  377. Windows PC's. The files can be kept up-to-date much more easily than
  378. paper documents, and there is no danger of someone working with an
  379. obsolete version of, say, an interface specification. They can be
  380. called up when needed during testing at any location that has Internet
  381. access, saving time and guesswork. It is at least hoped that this
  382. will save paper as well.
  383.  
  384. DATA GENERATORS
  385.  
  386. The rover software employs several related data tables and identifier lists
  387. to work with devices, sensors, and operator commands. In order to reduce
  388. the effort of changing these tables, and to eliminate the risk of tables
  389. being out of synchronization, scripts using the UNIX "AWK" program were
  390. built to generate the tables and identifiers from description files.
  391. For example, one file describes all of the analog sensors - multiplexor
  392. addresses, input gain settings, minimum and maximum expected values,
  393. etc. - and is processed into a list of sensor identifier codes, encoded
  394. tables used by the sensor input functions to setup and sample the
  395. sensor data, limit tables used by health check functions to validate
  396. sensor operation, and so on. Several times during development, there
  397. have been hardware changes that were quickly incorporated into the
  398. software by simple updates to the tables or the generator functions,
  399. without worrying about missing some corresponding change in a forgotten
  400. source file.
  401.  
  402. TEST UTILITIES
  403.  
  404. Development risk was reduced by implementing temporary software to
  405. stand in for external interfaces, eliminating dependence on
  406. other subsystems. Especially useful is the "simulator" for the
  407. lander spacecraft, which communicates with the
  408. rover by radio modem. Besides supporting tests of the modem 
  409. communication protocol
  410. itself, this program accepts operator commands in text form (typed in
  411. or read from a command file) or in the official sequence file format
  412. (as generated by the Rover Control Workstation) and sends them to
  413. the rover. It also receives telemetry data from the rover, storing
  414. it on disk and optionally relaying it through a socket connection
  415. to other test software. This lander simulator can be run either in
  416. a window on a UNIX workstation, or on a PC (such as a laptop used
  417. for remote testing).
  418.  
  419. Another utility program can extract data from telemetry packets, and
  420. thus stands in for the ground data system, providing real-time
  421. (when connected to the lander simulator telemetry socket) and
  422. after-the-fact (when fed stored data files) viewing of telemetry.
  423. Related programs allow conversion of extracted image data, both
  424. normal and compressed, into a standard format for viewing and
  425. analysis.
  426.  
  427. These facilities have allowed end-to-end testing of the rover
  428. before the actual control workstation, lander, or ground data
  429. system were ready for integration. When such integration did
  430. take place, the rover team could was confident that its side
  431. of the interfaces had already been verified.
  432.  
  433. A simple downloadable menu-driven diagnostic program also proved to be 
  434. worth far more than its development cost. This utility provides a 
  435. thorough but easy-to-run regression test after hardware changes and 
  436. environmental testing, a convenient facility for direct control of 
  437. rover devices, and a "second opinion" on sensor or control anomalies 
  438. observed by the operational rover software.
  439.  
  440. THE PATH AHEAD
  441.  
  442. The Pathfinder spacecraft is scheduled to launch in December 1996,
  443. arriving at Mars in July 1997. During integration testing
  444. so far, the microrover software has performed well, often demonstrating
  445. its flexibility and reliability when faced with changes in plans and
  446. hardware failures. Perhaps the biggest complaint is that it sometimes
  447. thinks too much, overriding our commands when we forget to tell it
  448. not to worry about some component that was temporarily removed.
  449. Fortunately, by the time the rover rolls out onto the surface of
  450. the red planet, we will be well-practiced in the art of cooperating
  451. with a semi-autonomous rover, and ready to explore together.